using UnityEngine;
using System.Collections;

public class GameScript : MonoBehaviour {

	private Rect windowRect = new Rect (Screen.width / 2 - 175, Screen.height / 2 - 75, 355, 95);
	
		public bool win = false;
	
	void update()
	{
		
	}
	
	void OnGUI()
	{
		//bool win = true;
		//windowRect = GUI.Window (0, windowRect, WindowFunction, "");
		GUI.Label (new Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100), "YAY! This is the game! YAY!");
		
		if(Input.GetKeyDown("escape")&&win==false)
			{
				win = true;
			}
			if(Input.GetKeyUp("escape")&&  win==true)
			{
				win = false;	
			}
		
		if (win == true) 
		{
			GUILayout.BeginArea (windowRect = GUI.Window (0, windowRect, WindowFunction, ""));
			
			GUILayout.Label("Are you sure you want to quit?");
			GUILayout.BeginHorizontal();
			
			if(GUILayout.Button ("Yes"))
			{
				Application.LoadLevel("Menu");
			}
			
			if(GUILayout.Button ("No"))
			{
				win = false;
			}
			
			GUILayout.EndHorizontal();
			GUILayout.EndArea();
		}
		

		
	}
		void WindowFunction (int windowID) {
		// Draw any Controls inside the window here
	}
}
